using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponHammer : Weapon
{
    public BoxCollider _collider;

    private bool isAttack;

    public int power;

    private void Start()
    {
        _collider.enabled = false;
    }

    public override void AttackBegin()
    {
        _collider.enabled = true;
        isAttack = true;    
    }

    public override void AttackEnd()
    {
        _collider.enabled = false;
        isAttack = false;
    }

    private void Update()
    {

    }

    public void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Door")
        {
            collision.rigidbody.AddForce((transform.position - collision.transform.position).normalized * power);
        }
    }
}
